import 'package:seedfour/generated/json/base/json_convert_content.dart';
import 'package:seedfour/app/models/alloc_detail_entity.dart';

AllocDetailEntity $AllocDetailEntityFromJson(Map<String, dynamic> json) {
  final AllocDetailEntity allocDetailEntity = AllocDetailEntity();
  final AllocDetailOrderInfo? orderInfo = jsonConvert.convert<
      AllocDetailOrderInfo>(json['orderInfo']);
  if (orderInfo != null) {
    allocDetailEntity.orderInfo = orderInfo;
  }
  final AllocDetailCaseInfo? caseInfo = jsonConvert.convert<
      AllocDetailCaseInfo>(json['caseInfo']);
  if (caseInfo != null) {
    allocDetailEntity.caseInfo = caseInfo;
  }
  final AllocDetailAllocContent? allocContent = jsonConvert.convert<
      AllocDetailAllocContent>(json['allocContent']);
  if (allocContent != null) {
    allocDetailEntity.allocContent = allocContent;
  }
  return allocDetailEntity;
}

Map<String, dynamic> $AllocDetailEntityToJson(AllocDetailEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['orderInfo'] = entity.orderInfo?.toJson();
  data['caseInfo'] = entity.caseInfo?.toJson();
  data['allocContent'] = entity.allocContent?.toJson();
  return data;
}

extension AllocDetailEntityExtension on AllocDetailEntity {
  AllocDetailEntity copyWith({
    AllocDetailOrderInfo? orderInfo,
    AllocDetailCaseInfo? caseInfo,
    AllocDetailAllocContent? allocContent,
  }) {
    return AllocDetailEntity()
      ..orderInfo = orderInfo ?? this.orderInfo
      ..caseInfo = caseInfo ?? this.caseInfo
      ..allocContent = allocContent ?? this.allocContent;
  }
}

AllocDetailOrderInfo $AllocDetailOrderInfoFromJson(Map<String, dynamic> json) {
  final AllocDetailOrderInfo allocDetailOrderInfo = AllocDetailOrderInfo();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    allocDetailOrderInfo.id = id;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    allocDetailOrderInfo.name = name;
  }
  final int? orderAmount = jsonConvert.convert<int>(json['orderAmount']);
  if (orderAmount != null) {
    allocDetailOrderInfo.orderAmount = orderAmount;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    allocDetailOrderInfo.status = status;
  }
  final bool? isOwner = jsonConvert.convert<bool>(json['isOwner']);
  if (isOwner != null) {
    allocDetailOrderInfo.isOwner = isOwner;
  }
  final String? settleName = jsonConvert.convert<String>(json['settleName']);
  if (settleName != null) {
    allocDetailOrderInfo.settleName = settleName;
  }
  final AllocDetailOrderInfoInvoice? invoice = jsonConvert.convert<
      AllocDetailOrderInfoInvoice>(json['invoice']);
  if (invoice != null) {
    allocDetailOrderInfo.invoice = invoice;
  }
  return allocDetailOrderInfo;
}

Map<String, dynamic> $AllocDetailOrderInfoToJson(AllocDetailOrderInfo entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['name'] = entity.name;
  data['orderAmount'] = entity.orderAmount;
  data['status'] = entity.status;
  data['isOwner'] = entity.isOwner;
  data['settleName'] = entity.settleName;
  data['invoice'] = entity.invoice?.toJson();
  return data;
}

extension AllocDetailOrderInfoExtension on AllocDetailOrderInfo {
  AllocDetailOrderInfo copyWith({
    String? id,
    String? name,
    int? orderAmount,
    int? status,
    bool? isOwner,
    String? settleName,
    AllocDetailOrderInfoInvoice? invoice,
  }) {
    return AllocDetailOrderInfo()
      ..id = id ?? this.id
      ..name = name ?? this.name
      ..orderAmount = orderAmount ?? this.orderAmount
      ..status = status ?? this.status
      ..isOwner = isOwner ?? this.isOwner
      ..settleName = settleName ?? this.settleName
      ..invoice = invoice ?? this.invoice;
  }
}

AllocDetailOrderInfoInvoice $AllocDetailOrderInfoInvoiceFromJson(
    Map<String, dynamic> json) {
  final AllocDetailOrderInfoInvoice allocDetailOrderInfoInvoice = AllocDetailOrderInfoInvoice();
  final String? cargo = jsonConvert.convert<String>(json['cargo']);
  if (cargo != null) {
    allocDetailOrderInfoInvoice.cargo = cargo;
  }
  final String? showTab = jsonConvert.convert<String>(json['showTab']);
  if (showTab != null) {
    allocDetailOrderInfoInvoice.showTab = showTab;
  }
  final String? email = jsonConvert.convert<String>(json['email']);
  if (email != null) {
    allocDetailOrderInfoInvoice.email = email;
  }
  final List<
      AllocDetailOrderInfoInvoiceRelateCases>? relateCases = (json['relateCases'] as List<
      dynamic>?)?.map(
          (e) =>
      jsonConvert.convert<AllocDetailOrderInfoInvoiceRelateCases>(
          e) as AllocDetailOrderInfoInvoiceRelateCases).toList();
  if (relateCases != null) {
    allocDetailOrderInfoInvoice.relateCases = relateCases;
  }
  return allocDetailOrderInfoInvoice;
}

Map<String, dynamic> $AllocDetailOrderInfoInvoiceToJson(
    AllocDetailOrderInfoInvoice entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['cargo'] = entity.cargo;
  data['showTab'] = entity.showTab;
  data['email'] = entity.email;
  data['relateCases'] = entity.relateCases?.map((v) => v.toJson()).toList();
  return data;
}

extension AllocDetailOrderInfoInvoiceExtension on AllocDetailOrderInfoInvoice {
  AllocDetailOrderInfoInvoice copyWith({
    String? cargo,
    String? showTab,
    String? email,
    List<AllocDetailOrderInfoInvoiceRelateCases>? relateCases,
  }) {
    return AllocDetailOrderInfoInvoice()
      ..cargo = cargo ?? this.cargo
      ..showTab = showTab ?? this.showTab
      ..email = email ?? this.email
      ..relateCases = relateCases ?? this.relateCases;
  }
}

AllocDetailOrderInfoInvoiceRelateCases $AllocDetailOrderInfoInvoiceRelateCasesFromJson(
    Map<String, dynamic> json) {
  final AllocDetailOrderInfoInvoiceRelateCases allocDetailOrderInfoInvoiceRelateCases = AllocDetailOrderInfoInvoiceRelateCases();
  final String? caseId = jsonConvert.convert<String>(json['caseId']);
  if (caseId != null) {
    allocDetailOrderInfoInvoiceRelateCases.caseId = caseId;
  }
  final String? caseName = jsonConvert.convert<String>(json['caseName']);
  if (caseName != null) {
    allocDetailOrderInfoInvoiceRelateCases.caseName = caseName;
  }
  return allocDetailOrderInfoInvoiceRelateCases;
}

Map<String, dynamic> $AllocDetailOrderInfoInvoiceRelateCasesToJson(
    AllocDetailOrderInfoInvoiceRelateCases entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['caseId'] = entity.caseId;
  data['caseName'] = entity.caseName;
  return data;
}

extension AllocDetailOrderInfoInvoiceRelateCasesExtension on AllocDetailOrderInfoInvoiceRelateCases {
  AllocDetailOrderInfoInvoiceRelateCases copyWith({
    String? caseId,
    String? caseName,
  }) {
    return AllocDetailOrderInfoInvoiceRelateCases()
      ..caseId = caseId ?? this.caseId
      ..caseName = caseName ?? this.caseName;
  }
}

AllocDetailCaseInfo $AllocDetailCaseInfoFromJson(Map<String, dynamic> json) {
  final AllocDetailCaseInfo allocDetailCaseInfo = AllocDetailCaseInfo();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    allocDetailCaseInfo.id = id;
  }
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    allocDetailCaseInfo.title = title;
  }
  final int? updatedAt = jsonConvert.convert<int>(json['updatedAt']);
  if (updatedAt != null) {
    allocDetailCaseInfo.updatedAt = updatedAt;
  }
  final String? collectionDate = jsonConvert.convert<String>(
      json['collectionDate']);
  if (collectionDate != null) {
    allocDetailCaseInfo.collectionDate = collectionDate;
  }
  final int? orderAmount = jsonConvert.convert<int>(json['orderAmount']);
  if (orderAmount != null) {
    allocDetailCaseInfo.orderAmount = orderAmount;
  }
  final String? agentUid = jsonConvert.convert<String>(json['agentUid']);
  if (agentUid != null) {
    allocDetailCaseInfo.agentUid = agentUid;
  }
  final String? agentUsername = jsonConvert.convert<String>(
      json['agentUsername']);
  if (agentUsername != null) {
    allocDetailCaseInfo.agentUsername = agentUsername;
  }
  final String? updatedAtStr = jsonConvert.convert<String>(
      json['updatedAtStr']);
  if (updatedAtStr != null) {
    allocDetailCaseInfo.updatedAtStr = updatedAtStr;
  }
  final String? orderAmountStr = jsonConvert.convert<String>(
      json['orderAmountStr']);
  if (orderAmountStr != null) {
    allocDetailCaseInfo.orderAmountStr = orderAmountStr;
  }
  return allocDetailCaseInfo;
}

Map<String, dynamic> $AllocDetailCaseInfoToJson(AllocDetailCaseInfo entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['title'] = entity.title;
  data['updatedAt'] = entity.updatedAt;
  data['collectionDate'] = entity.collectionDate;
  data['orderAmount'] = entity.orderAmount;
  data['agentUid'] = entity.agentUid;
  data['agentUsername'] = entity.agentUsername;
  data['updatedAtStr'] = entity.updatedAtStr;
  data['orderAmountStr'] = entity.orderAmountStr;
  return data;
}

extension AllocDetailCaseInfoExtension on AllocDetailCaseInfo {
  AllocDetailCaseInfo copyWith({
    String? id,
    String? title,
    int? updatedAt,
    String? collectionDate,
    int? orderAmount,
    String? agentUid,
    String? agentUsername,
    String? updatedAtStr,
    String? orderAmountStr,
  }) {
    return AllocDetailCaseInfo()
      ..id = id ?? this.id
      ..title = title ?? this.title
      ..updatedAt = updatedAt ?? this.updatedAt
      ..collectionDate = collectionDate ?? this.collectionDate
      ..orderAmount = orderAmount ?? this.orderAmount
      ..agentUid = agentUid ?? this.agentUid
      ..agentUsername = agentUsername ?? this.agentUsername
      ..updatedAtStr = updatedAtStr ?? this.updatedAtStr
      ..orderAmountStr = orderAmountStr ?? this.orderAmountStr;
  }
}

AllocDetailAllocContent $AllocDetailAllocContentFromJson(
    Map<String, dynamic> json) {
  final AllocDetailAllocContent allocDetailAllocContent = AllocDetailAllocContent();
  final List<AllocDetailAllocContentPlans>? plans = (json['plans'] as List<
      dynamic>?)?.map(
          (e) =>
      jsonConvert.convert<AllocDetailAllocContentPlans>(
          e) as AllocDetailAllocContentPlans).toList();
  if (plans != null) {
    allocDetailAllocContent.plans = plans;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    allocDetailAllocContent.status = status;
  }
  final int? createDate = jsonConvert.convert<int>(json['createDate']);
  if (createDate != null) {
    allocDetailAllocContent.createDate = createDate;
  }
  final AllocDetailAllocContentOrder? order = jsonConvert.convert<
      AllocDetailAllocContentOrder>(json['order']);
  if (order != null) {
    allocDetailAllocContent.order = order;
  }
  final AllocDetailAllocContentRemain? remain = jsonConvert.convert<
      AllocDetailAllocContentRemain>(json['remain']);
  if (remain != null) {
    allocDetailAllocContent.remain = remain;
  }
  final List<AllocDetailAllocContentCplans>? cplans = (json['cplans'] as List<
      dynamic>?)?.map(
          (e) =>
      jsonConvert.convert<AllocDetailAllocContentCplans>(
          e) as AllocDetailAllocContentCplans).toList();
  if (cplans != null) {
    allocDetailAllocContent.cplans = cplans;
  }
  final AllocDetailAllocContentAlloc? alloc = jsonConvert.convert<
      AllocDetailAllocContentAlloc>(json['alloc']);
  if (alloc != null) {
    allocDetailAllocContent.alloc = alloc;
  }
  return allocDetailAllocContent;
}

Map<String, dynamic> $AllocDetailAllocContentToJson(
    AllocDetailAllocContent entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['plans'] = entity.plans?.map((v) => v.toJson()).toList();
  data['status'] = entity.status;
  data['createDate'] = entity.createDate;
  data['order'] = entity.order?.toJson();
  data['remain'] = entity.remain?.toJson();
  data['cplans'] = entity.cplans?.map((v) => v.toJson()).toList();
  data['alloc'] = entity.alloc?.toJson();
  return data;
}

extension AllocDetailAllocContentExtension on AllocDetailAllocContent {
  AllocDetailAllocContent copyWith({
    List<AllocDetailAllocContentPlans>? plans,
    int? status,
    int? createDate,
    AllocDetailAllocContentOrder? order,
    AllocDetailAllocContentRemain? remain,
    List<AllocDetailAllocContentCplans>? cplans,
    AllocDetailAllocContentAlloc? alloc,
  }) {
    return AllocDetailAllocContent()
      ..plans = plans ?? this.plans
      ..status = status ?? this.status
      ..createDate = createDate ?? this.createDate
      ..order = order ?? this.order
      ..remain = remain ?? this.remain
      ..cplans = cplans ?? this.cplans
      ..alloc = alloc ?? this.alloc;
  }
}

AllocDetailAllocContentPlans $AllocDetailAllocContentPlansFromJson(
    Map<String, dynamic> json) {
  final AllocDetailAllocContentPlans allocDetailAllocContentPlans = AllocDetailAllocContentPlans();
  final List<AllocDetailAllocContentPlansAlloc>? alloc = (json['alloc'] as List<
      dynamic>?)?.map(
          (e) =>
      jsonConvert.convert<AllocDetailAllocContentPlansAlloc>(
          e) as AllocDetailAllocContentPlansAlloc).toList();
  if (alloc != null) {
    allocDetailAllocContentPlans.alloc = alloc;
  }
  final int? totalAmount = jsonConvert.convert<int>(json['totalAmount']);
  if (totalAmount != null) {
    allocDetailAllocContentPlans.totalAmount = totalAmount;
  }
  final int? totalPercent = jsonConvert.convert<int>(json['totalPercent']);
  if (totalPercent != null) {
    allocDetailAllocContentPlans.totalPercent = totalPercent;
  }
  final int? planStatus = jsonConvert.convert<int>(json['planStatus']);
  if (planStatus != null) {
    allocDetailAllocContentPlans.planStatus = planStatus;
  }
  final String? approveDate = jsonConvert.convert<String>(json['approveDate']);
  if (approveDate != null) {
    allocDetailAllocContentPlans.approveDate = approveDate;
  }
  final String? approveRemark = jsonConvert.convert<String>(
      json['approveRemark']);
  if (approveRemark != null) {
    allocDetailAllocContentPlans.approveRemark = approveRemark;
  }
  final List<dynamic>? attaches = (json['attaches'] as List<dynamic>?)?.map(
          (e) => e).toList();
  if (attaches != null) {
    allocDetailAllocContentPlans.attaches = attaches;
  }
  final String? approveUid = jsonConvert.convert<String>(json['approveUid']);
  if (approveUid != null) {
    allocDetailAllocContentPlans.approveUid = approveUid;
  }
  return allocDetailAllocContentPlans;
}

Map<String, dynamic> $AllocDetailAllocContentPlansToJson(
    AllocDetailAllocContentPlans entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['alloc'] = entity.alloc?.map((v) => v.toJson()).toList();
  data['totalAmount'] = entity.totalAmount;
  data['totalPercent'] = entity.totalPercent;
  data['planStatus'] = entity.planStatus;
  data['approveDate'] = entity.approveDate;
  data['approveRemark'] = entity.approveRemark;
  data['attaches'] = entity.attaches;
  data['approveUid'] = entity.approveUid;
  return data;
}

extension AllocDetailAllocContentPlansExtension on AllocDetailAllocContentPlans {
  AllocDetailAllocContentPlans copyWith({
    List<AllocDetailAllocContentPlansAlloc>? alloc,
    int? totalAmount,
    int? totalPercent,
    int? planStatus,
    String? approveDate,
    String? approveRemark,
    List<dynamic>? attaches,
    String? approveUid,
  }) {
    return AllocDetailAllocContentPlans()
      ..alloc = alloc ?? this.alloc
      ..totalAmount = totalAmount ?? this.totalAmount
      ..totalPercent = totalPercent ?? this.totalPercent
      ..planStatus = planStatus ?? this.planStatus
      ..approveDate = approveDate ?? this.approveDate
      ..approveRemark = approveRemark ?? this.approveRemark
      ..attaches = attaches ?? this.attaches
      ..approveUid = approveUid ?? this.approveUid;
  }
}

AllocDetailAllocContentPlansAlloc $AllocDetailAllocContentPlansAllocFromJson(
    Map<String, dynamic> json) {
  final AllocDetailAllocContentPlansAlloc allocDetailAllocContentPlansAlloc = AllocDetailAllocContentPlansAlloc();
  final String? uid = jsonConvert.convert<String>(json['uid']);
  if (uid != null) {
    allocDetailAllocContentPlansAlloc.uid = uid;
  }
  final int? percent = jsonConvert.convert<int>(json['percent']);
  if (percent != null) {
    allocDetailAllocContentPlansAlloc.percent = percent;
  }
  final int? amount = jsonConvert.convert<int>(json['amount']);
  if (amount != null) {
    allocDetailAllocContentPlansAlloc.amount = amount;
  }
  final String? mobile = jsonConvert.convert<String>(json['mobile']);
  if (mobile != null) {
    allocDetailAllocContentPlansAlloc.mobile = mobile;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    allocDetailAllocContentPlansAlloc.name = name;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    allocDetailAllocContentPlansAlloc.id = id;
  }
  return allocDetailAllocContentPlansAlloc;
}

Map<String, dynamic> $AllocDetailAllocContentPlansAllocToJson(
    AllocDetailAllocContentPlansAlloc entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['uid'] = entity.uid;
  data['percent'] = entity.percent;
  data['amount'] = entity.amount;
  data['mobile'] = entity.mobile;
  data['name'] = entity.name;
  data['id'] = entity.id;
  return data;
}

extension AllocDetailAllocContentPlansAllocExtension on AllocDetailAllocContentPlansAlloc {
  AllocDetailAllocContentPlansAlloc copyWith({
    String? uid,
    int? percent,
    int? amount,
    String? mobile,
    String? name,
    String? id,
  }) {
    return AllocDetailAllocContentPlansAlloc()
      ..uid = uid ?? this.uid
      ..percent = percent ?? this.percent
      ..amount = amount ?? this.amount
      ..mobile = mobile ?? this.mobile
      ..name = name ?? this.name
      ..id = id ?? this.id;
  }
}

AllocDetailAllocContentOrder $AllocDetailAllocContentOrderFromJson(
    Map<String, dynamic> json) {
  final AllocDetailAllocContentOrder allocDetailAllocContentOrder = AllocDetailAllocContentOrder();
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    allocDetailAllocContentOrder.title = title;
  }
  final int? orderAmount = jsonConvert.convert<int>(json['orderAmount']);
  if (orderAmount != null) {
    allocDetailAllocContentOrder.orderAmount = orderAmount;
  }
  final int? collectionDate = jsonConvert.convert<int>(json['collectionDate']);
  if (collectionDate != null) {
    allocDetailAllocContentOrder.collectionDate = collectionDate;
  }
  final String? agentUsername = jsonConvert.convert<String>(
      json['agentUsername']);
  if (agentUsername != null) {
    allocDetailAllocContentOrder.agentUsername = agentUsername;
  }
  return allocDetailAllocContentOrder;
}

Map<String, dynamic> $AllocDetailAllocContentOrderToJson(
    AllocDetailAllocContentOrder entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['title'] = entity.title;
  data['orderAmount'] = entity.orderAmount;
  data['collectionDate'] = entity.collectionDate;
  data['agentUsername'] = entity.agentUsername;
  return data;
}

extension AllocDetailAllocContentOrderExtension on AllocDetailAllocContentOrder {
  AllocDetailAllocContentOrder copyWith({
    String? title,
    int? orderAmount,
    int? collectionDate,
    String? agentUsername,
  }) {
    return AllocDetailAllocContentOrder()
      ..title = title ?? this.title
      ..orderAmount = orderAmount ?? this.orderAmount
      ..collectionDate = collectionDate ?? this.collectionDate
      ..agentUsername = agentUsername ?? this.agentUsername;
  }
}

AllocDetailAllocContentRemain $AllocDetailAllocContentRemainFromJson(
    Map<String, dynamic> json) {
  final AllocDetailAllocContentRemain allocDetailAllocContentRemain = AllocDetailAllocContentRemain();
  final double? amount = jsonConvert.convert<double>(json['amount']);
  if (amount != null) {
    allocDetailAllocContentRemain.amount = amount;
  }
  final int? available = jsonConvert.convert<int>(json['available']);
  if (available != null) {
    allocDetailAllocContentRemain.available = available;
  }
  return allocDetailAllocContentRemain;
}

Map<String, dynamic> $AllocDetailAllocContentRemainToJson(
    AllocDetailAllocContentRemain entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['amount'] = entity.amount;
  data['available'] = entity.available;
  return data;
}

extension AllocDetailAllocContentRemainExtension on AllocDetailAllocContentRemain {
  AllocDetailAllocContentRemain copyWith({
    double? amount,
    int? available,
  }) {
    return AllocDetailAllocContentRemain()
      ..amount = amount ?? this.amount
      ..available = available ?? this.available;
  }
}

AllocDetailAllocContentCplans $AllocDetailAllocContentCplansFromJson(
    Map<String, dynamic> json) {
  final AllocDetailAllocContentCplans allocDetailAllocContentCplans = AllocDetailAllocContentCplans();
  final int? type = jsonConvert.convert<int>(json['type']);
  if (type != null) {
    allocDetailAllocContentCplans.type = type;
  }
  final int? totalAmount = jsonConvert.convert<int>(json['totalAmount']);
  if (totalAmount != null) {
    allocDetailAllocContentCplans.totalAmount = totalAmount;
  }
  final int? totalPercent = jsonConvert.convert<int>(json['totalPercent']);
  if (totalPercent != null) {
    allocDetailAllocContentCplans.totalPercent = totalPercent;
  }
  final String? createDate = jsonConvert.convert<String>(json['createDate']);
  if (createDate != null) {
    allocDetailAllocContentCplans.createDate = createDate;
  }
  final String? remark = jsonConvert.convert<String>(json['remark']);
  if (remark != null) {
    allocDetailAllocContentCplans.remark = remark;
  }
  final List<
      AllocDetailAllocContentCplansPlans>? plans = (json['plans'] as List<
      dynamic>?)?.map(
          (e) =>
      jsonConvert.convert<AllocDetailAllocContentCplansPlans>(
          e) as AllocDetailAllocContentCplansPlans).toList();
  if (plans != null) {
    allocDetailAllocContentCplans.plans = plans;
  }
  return allocDetailAllocContentCplans;
}

Map<String, dynamic> $AllocDetailAllocContentCplansToJson(
    AllocDetailAllocContentCplans entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['type'] = entity.type;
  data['totalAmount'] = entity.totalAmount;
  data['totalPercent'] = entity.totalPercent;
  data['createDate'] = entity.createDate;
  data['remark'] = entity.remark;
  data['plans'] = entity.plans?.map((v) => v.toJson()).toList();
  return data;
}

extension AllocDetailAllocContentCplansExtension on AllocDetailAllocContentCplans {
  AllocDetailAllocContentCplans copyWith({
    int? type,
    int? totalAmount,
    int? totalPercent,
    String? createDate,
    String? remark,
    List<AllocDetailAllocContentCplansPlans>? plans,
  }) {
    return AllocDetailAllocContentCplans()
      ..type = type ?? this.type
      ..totalAmount = totalAmount ?? this.totalAmount
      ..totalPercent = totalPercent ?? this.totalPercent
      ..createDate = createDate ?? this.createDate
      ..remark = remark ?? this.remark
      ..plans = plans ?? this.plans;
  }
}

AllocDetailAllocContentCplansPlans $AllocDetailAllocContentCplansPlansFromJson(
    Map<String, dynamic> json) {
  final AllocDetailAllocContentCplansPlans allocDetailAllocContentCplansPlans = AllocDetailAllocContentCplansPlans();
  final int? type = jsonConvert.convert<int>(json['type']);
  if (type != null) {
    allocDetailAllocContentCplansPlans.type = type;
  }
  final int? amount = jsonConvert.convert<int>(json['amount']);
  if (amount != null) {
    allocDetailAllocContentCplansPlans.amount = amount;
  }
  final int? percent = jsonConvert.convert<int>(json['percent']);
  if (percent != null) {
    allocDetailAllocContentCplansPlans.percent = percent;
  }
  final String? createDate = jsonConvert.convert<String>(json['createDate']);
  if (createDate != null) {
    allocDetailAllocContentCplansPlans.createDate = createDate;
  }
  final String? remark = jsonConvert.convert<String>(json['remark']);
  if (remark != null) {
    allocDetailAllocContentCplansPlans.remark = remark;
  }
  return allocDetailAllocContentCplansPlans;
}

Map<String, dynamic> $AllocDetailAllocContentCplansPlansToJson(
    AllocDetailAllocContentCplansPlans entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['type'] = entity.type;
  data['amount'] = entity.amount;
  data['percent'] = entity.percent;
  data['createDate'] = entity.createDate;
  data['remark'] = entity.remark;
  return data;
}

extension AllocDetailAllocContentCplansPlansExtension on AllocDetailAllocContentCplansPlans {
  AllocDetailAllocContentCplansPlans copyWith({
    int? type,
    int? amount,
    int? percent,
    String? createDate,
    String? remark,
  }) {
    return AllocDetailAllocContentCplansPlans()
      ..type = type ?? this.type
      ..amount = amount ?? this.amount
      ..percent = percent ?? this.percent
      ..createDate = createDate ?? this.createDate
      ..remark = remark ?? this.remark;
  }
}

AllocDetailAllocContentAlloc $AllocDetailAllocContentAllocFromJson(
    Map<String, dynamic> json) {
  final AllocDetailAllocContentAlloc allocDetailAllocContentAlloc = AllocDetailAllocContentAlloc();
  final int? amount = jsonConvert.convert<int>(json['amount']);
  if (amount != null) {
    allocDetailAllocContentAlloc.amount = amount;
  }
  final int? percent = jsonConvert.convert<int>(json['percent']);
  if (percent != null) {
    allocDetailAllocContentAlloc.percent = percent;
  }
  return allocDetailAllocContentAlloc;
}

Map<String, dynamic> $AllocDetailAllocContentAllocToJson(
    AllocDetailAllocContentAlloc entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['amount'] = entity.amount;
  data['percent'] = entity.percent;
  return data;
}

extension AllocDetailAllocContentAllocExtension on AllocDetailAllocContentAlloc {
  AllocDetailAllocContentAlloc copyWith({
    int? amount,
    int? percent,
  }) {
    return AllocDetailAllocContentAlloc()
      ..amount = amount ?? this.amount
      ..percent = percent ?? this.percent;
  }
}